grafica % = 113

if (0)
    f = fopen(sprintf('data_%d.txt', grafica))    
    a_pre = fscanf(f, '%g', [7 inf])';
    fclose (f)
    
    a = a_pre;
    for i=1:length(a_pre)
        a(a_pre(i,1),:) = a_pre(i,:);
    end
    a = a(1:max(a_pre(:,1)), :);
    a(:,1) = 1:max(a_pre(:,1));
    
    [n, m] = size(a);
    medio = 300;
    factor = 200;
    
    I2 = ones(medio*2, n);
    I2(medio, :) = 0.5;
    I3 = ones(medio*2, n);
    I3(medio, :) = 0.5;
    I4 = ones(medio*2, n);
    I4(medio, :) = 0.5;

    for i=1:n
        I2(round(a(i,2)*factor + medio), a(i,1)) = 0;
        I3(round(a(i,3)*factor + medio), a(i,1)) = 0;
        I4(round(a(i,4)*factor + medio), a(i,1)) = 0;
    end

    figure(2)
    subplot(2,2,2)
    imshow(I2)
    imwrite(I2, 'a2.bmp')
    subplot(2,2,3)
    imshow(I3)
    imwrite(I3, 'a3.bmp')
    subplot(2,2,4)
    imshow(I4)
    imwrite(I4, 'a4.bmp')

else
    v = zeros(1,1,3);
    v(1,1,1)=255;
    v(1,1,2)=0;
    v(1,1,3)=0;
    a2 = zeros(m,n);
    I22 = imread('a22.bmp');    
    I33 = imread('a33.bmp');    
    I44 = imread('a44.bmp');    
    
    for i=1:n
        for j=1:medio*2
            if (I22(j,i,:) == v)
                a2(i,2) = (j + rand()-medio)/factor;
            end
            if (I33(j,i,:) == v)
                a2(i,3) = (j + rand()-medio)/factor;
            end
            if (I44(j,i,:) == v)
                a2(i,4) = (j + rand()-medio)/factor;
            end
        end
    end
    
    a2= a2(:,1:4);
    a_pre2 = a_pre;
    for i=1:length(a_pre2)
        a_pre2(i,2:4) = a2(a_pre2(i,1),2:4);
    end
    f = fopen(sprintf('data_%d__2.txt', grafica), 'w')    
    fprintf(f, '%g %g %g %g %g %g %g \n', a_pre2');
    fclose (f)
    
    hacer_grafica
  
    
end

